package com.theanh.RssActivity.entity;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Bitmap;

import com.theanh.RssActivity.util.StringUtils;

public class Channel {
	private int id;
	private String name;
	private String url;
	private String logoUrl;
	private int categoryID;
	private List<Item> items;
	private boolean updating = false;
	
	public String getLogoUrl() {
		return logoUrl;
	}

	public void setLogoUrl(String logoUrl) {
		this.logoUrl = logoUrl;
	}

	public boolean isUpdating() {
		return updating;
	}

	public void setUpdating(boolean updating) {
		this.updating = updating;
	}

	public Channel(){
		this.items = new ArrayList<Item>();
	}
	
	public Channel(int id,String image, String url, int categoryID){
		this.id = id;
		this.name = name;
		this.url = url;
		this.categoryID = categoryID;
		
		this.items = new ArrayList<Item>();
	}

	public void setItems(List<Item> items) {
		this.items = items;
	}

	public void addItem(Item item){
		item.setChannelID(id);
		items.add(item);
	}
	
	public void removeItem(Item item){
		items.remove(item);
	}
	
	public Item removeItem(int location){
		return items.remove(location);
	}
	
	public int getID(){
		return id;
	}
	
	public String getName(){
		return name;
	}
	
	public String getUrl(){
		return url;
	}
	public int getCategoryID(){
		return categoryID;
	}
	
	public List<Item> getItems(){
		return items;
	}
	public int getCountItems(){
		return items.size();
	}
	public void setID(int id){
		this.id = id;
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public void setUrl(String url){
		this.url = url;
	}
	
	public void setCategoryID(int categoryID){
		this.categoryID = categoryID;
	}
	
	public String toString(){
		return "ID=" + id +", Name=" + name +", Url=" + url +", CategoryID=" + categoryID;
	}
	public boolean validate() {
		if (StringUtils.isNullOrEmpty(name)|| StringUtils.isNullOrEmpty(url)) {
			return false;
		}
		return true;
	}
}
